Skip to content

fix(wallet): exclude live balances from walletStore persistence (Fixes #128) - #133

Merged
cybermax4200 merged 1 commit into
ecotask-network:mainfrom
waterWang:fix/wallet-partialize-128
Aug 26, 2026
Merged

fix(wallet): exclude live balances from walletStore persistence (Fixes #128)#133
cybermax4200 merged 1 commit into
ecotask-network:mainfrom
waterWang:fix/wallet-partialize-128

Conversation

@waterWang

@waterWang waterWang commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Description

walletStore currently persists balance, ecoBalance, and usdcBalance through partialize, so a stale MMKV snapshot is served as live data on cold start. This PR adds a partializeWalletState helper (mirroring the existing partializeTaskState pattern) that persists only identity fields (isConnected, publicKey, walletType).

Changes

  • src/store/walletStore.ts — Extract partializeWalletState pure function; persist only isConnected, publicKey, walletType. Balances are excluded: they are re-fetched by useStellarWallet's useEffect on rehydration.
  • src/__tests__/stores.test.ts — Add tests confirming: (1) partialize excludes balance fields, and (2) a rehydrated store starts with null balances.

Testing

  • 385 tests pass (43 suites)
  • tsc --noEmit passes

Closes #128

walletStore persisted balance/ecoBalance/usdcBalance through partialize,
so a stale MMKV snapshot was served as live data on cold start. Persist
only identity fields (isConnected, publicKey, walletType); balances are
re-fetched by useStellarWallet on rehydration.

Ref: ecotask-network#128

Signed-off-by: waterWang <water.wang@users.noreply.github.com>
@cybermax4200
cybermax4200 merged commit c1070b2 into ecotask-network:main Aug 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] walletStore has no partialize — stale XLM/ECO/USDC balances are persisted and served as live data on cold start

2 participants